import { createRouter, createWebHistory } from 'vue-router';

const router = createRouter({
    history: createWebHistory(),
    routes: [
        // 重定向
        {
            path: '/',
            redirect: '/index',
            component: () => import('@/views/index/Index.vue')
        },
        {
            path: '/index',
            name: '首页',
            component: () => import('@/views/index/Index.vue')
        },
        {
            path: '/energy',
            name: '能源管理',
            children: [{
                path: 'electric',
                name: '电能',
                children: [{
                    path: 'realTimeData',
                    name: '实时数据',
                    component: () => import('@/views/energy/electric/RealTimeData.vue')
                }]
            }]
        },
        {
            path: '/device',
            name: '设备',
            children: [{
                path: 'system',
                name: '设备管理',
                children: [{
                    path: 'smartConnector',
                    name: '智联器管理',
                    component: () => import('@/views/device/system/SmartConnector.vue')
                }, {
                    path: 'electricMeter',
                    name: '电表管理',
                    component: () => import('@/views/device/system/ElectricMeter.vue')
                }]
            }, {
                path: 'alarm',
                name: '告警管理',
                children: [ {
                    path: 'alarmSet',
                    name: '告警设置',
                    component: () => import('@/views/device/alarm/AlarmSet.vue')
                },{
                    path: 'alarmCenter',
                    name: '告警中心',
                    component: () => import('@/views/device/alarm/AlarmCenter.vue')
                },]
            }]
        }
    ]
});

export default router;